var fullTime = function(){
    this.hourlySalary = "15元"
}
var partTime = function(){
    this.hourlySalary = "12元"
}
var contractor = function(){
    this.hourlySalary = "20元"
}
var common = function(){
    this.hourlySalary = "10元"
}


function Facotory(){
    this.create = function(type){
    var employee
      switch(type){
        case "fulltime":
            employee = new fullTime();
            break
        case "parttime":
             employee = new partTime();
             break
        case "contractor":
            employee = new contractor();
            break
        default:
            employee = new common();
      }
     employee.type = type;
     employee.say = function(){
        console.log(`${this.type}: hourlySalary ${this.hourlySalary}`)
      }
      return employee
    }
}

var factory = new Facotory();
var employees = []
employees.push(factory.create("fulltime"))
employees.push(factory.create("parttime"))
employees.push(factory.create("contractor"))
employees.push(factory.create("common"))

employees.forEach(employee=>{
    employee.say()
})